<template>
    <page-header-wrapper>
        <a-card :bordered="false">
            <div class="table-page-search-wrapper">
                <s-filter :loading="loading" @query="query"/>
                <s-table :loading="loading" :cols="cols" :data="data"/>
            </div>
        </a-card>
    </page-header-wrapper>
</template>

<script>
    import STable from '@/components/Table/PagerTable'
    import SFilter from '@/components/Filter/StatisticsFilter'
    import API from "@/api"
    import Adapter from "@/utils/adapter"

    export default {
        components: {
            STable,
            SFilter
        },
        data() {
            return {
                loading: true,
                data: [],
                cols: [{title: '岗位', key: 'position'}, {title: '简历总数', key: 'col0'},
                    {title: '已面试', key: 'col1'}, {title: '面试通过', key: 'col2'},
                    {title: '安排签约', key: 'col3'}, {title: '已签约', key: 'col4'}]
            }
        },
        mounted() {
            this.query()
        },
        methods: {
            query(params) {
                this.loading = true
                API.Resume.Statistics(params || {}).then((res) => {
                    if (res) {
                        Adapter.Statistics(res.data)
                        this.data = res.data
                    }
                }).finally(() => this.loading = false)
            }
        }
    }
</script>
